/**
 * \brief Adapter for reducing resulting binary code size
 *        when using templates. Only one function has been
 *        shown for MatrixBase.
 *
 * \author Bartosz Kedra (bartosz.kedra@gmail.com)
 */
#include <iostream>
template <typename T> class MatrixBase
{
public:

   MatrixBase(T *data, unsigned size): matrix(data), size(size) {}
   T& operator[](int index) { return matrix[index]; }

private:

   T *matrix;
   unsigned size;
};

template <typename T, unsigned n> class Matrix: public MatrixBase<T>
{
public:
   Matrix(): MatrixBase<T>(data, n) {}

private:
   T data[n * n];
};


int main()
{
   Matrix<int, 10> matrix;
   matrix[2] = 10;

   std::cout << "Matrix[2] " << matrix[2] << std::endl;

   return 0;
}
